home *** CD-ROM | disk | FTP | other *** search
- /*
- File: PanelEditorUtils.h
-
- Contains: PanelEditor utility functions & classes
-
- Written by: Steve Smith
-
- Copyright: © 1994,95 by Apple Computer, Inc., all rights reserved.
- */
-
-
- #ifndef _PANELEDITORUTILS_
- #define _PANELEDITORUTILS_
-
- // --- OpenDoc Includes ---
-
- #ifndef _ODTYPES_
- #include <ODTypes.h>
- #endif
-
- // --- OpenDoc Utilities ---
-
- #ifndef _ITEXT_
- #include <IText.h>
- #endif
-
- #ifndef _ODDEBUG_
- #include <ODDebug.h>
- #endif
-
- #ifndef _ODUTILS_
- #include <ODUtils.h>
- #endif
-
- // --- Macintosh Includes ---
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- //------------------------------------------------------------------------------
- // Typedefs
- //------------------------------------------------------------------------------
-
- typedef struct ScrollDataRec {
- ODFrame* frame;
- Environment* ev;
- } ScrollDataRec;
-
- //------------------------------------------------------------------------------
- // Utility Class Definitions
- //------------------------------------------------------------------------------
-
- class CFrameProxy // (aka CFuton)
- {
- public:
- CFrameProxy();
- ~CFrameProxy();
-
- void InitFrameProxy(ODID frameID, ODDraft* draft);
- void InitFrameProxy(Environment* ev, ODFrame* frame);
- void Purge(Environment* ev);
-
- ODFrame* GetFrame(Environment* ev);
- void SetFrame(Environment* ev, ODFrame* frame);
- ODBoolean FrameIsLoaded(Environment* ev);
- ODID GetID();
- ODDraft* GetDraft();
-
- private:
- ODFrame* fFrame;
- ODID fID;
- ODDraft* fDraft;
- };
-
- class CDrawingText
- {
- public:
- CDrawingText();
- CDrawingText(ODIText* text);
- ~CDrawingText();
-
- private:
- GrafPtr port;
- short font;
- Style face;
- short size;
- };
-
- //------------------------------------------------------------------------------
- // Function Prototypes
- //------------------------------------------------------------------------------
-
- ODIText* GetPartName(Environment* ev, ODPart* part, ODType category);
- ODBoolean NamesAreEquivalent(Environment* ev, ODIText* fileName,
- ODIText* partName);
- void GetEditorScriptLanguage(Environment* ev, ODScriptCode* script,
- ODLangCode* language);
- void GetScriptFontSize(Environment* ev, ODScriptCode script,
- ODSShort* fontNum, ODUShort* fontSize);
-
- void FixedToIntRect(ODRect& fixedRect, Rect& intRect);
- void IntToFixedRect(Rect& intRect, ODRect& fixedRect);
-
- void LoadThumbnail(Environment* ev, Handle* thumbnail);
-
- Rect TilePartWindow(Environment* ev, Rect* facetBounds,
- Rect* partWindowBounds);
-
- ODUShort CountFramesFacets(Environment* ev, ODFrame* frame);
- void RemoveFacetsFromFrame(Environment* ev, ODFrame* frame);
-
- void GetQDFrameBounds(Environment* ev, ODFrame* frame, Rect* bounds);
-
- extern pascal void ScrollProc(ControlHandle control, short partCode);
-
-
-
- //-------------------------------------------------------------------------
- // Inline methods
- //-------------------------------------------------------------------------
-
- //=========================================================================
- // CFrameProxy
- //=========================================================================
-
- inline CFrameProxy::CFrameProxy()
- {
- fFrame = kODNULL;
- fID = kODNULLID;
- fDraft = kODNULL;
- }
-
- inline CFrameProxy::~CFrameProxy()
- {
- ODSafeReleaseObject(fFrame);
- }
-
- inline void CFrameProxy::InitFrameProxy(ODID frameID, ODDraft* draft)
- {
- ASSERT(draft!=kODNULL, kODErrIllegalNullInput);
-
- fFrame = kODNULL;
- fID = frameID;
- fDraft = draft;
- }
-
- inline void CFrameProxy::InitFrameProxy(Environment* ev, ODFrame* frame)
- {
- ASSERT(frame!=kODNULL, kODErrIllegalNullFrameInput);
-
- this->SetFrame(ev,frame);
- }
-
- inline ODID CFrameProxy::GetID()
- {
- return fID;
- }
-
- inline ODDraft* CFrameProxy::GetDraft()
- {
- return fDraft;
- }
-
-
- #endif
-
-